<template>
	<div>
		<div>
			<el-form ref="form"  label-width="100px">
				<el-form-item label="物流订单号">
					<el-input v-model="info.expOrder"></el-input>
				</el-form-item>

				<el-form-item>
					<el-button type="primary" :disabled="info.status!=1" @click="sent">立即发货</el-button>
					<el-button type="danger" @click="changeExp" :disabled="info.status!=2">修改订单号</el-button>
				</el-form-item>
			</el-form>
		</div>
	</div>
</template>

<script>
	export default {
		inject:["reload"],
		props: {
			info: {
				type: Object,
			}
		},
		data() {
			return {
			
			}
		},
		methods: {
			changeExp(){
				if (!this.info.expOrder) {
					this.$notify({
						title: '提示',
						message: '请填写物流单号',
						duration: 2000
					});
					return
				}
				
				this.axios.post("/admin/user/changeExp", {
					expOrder:this.info.expOrder,
					id:this.info.id,
				}).then(res => {
						this.$message.success({
							message: "修改成功",
							onClose: (res) => {
								this.reload()
							}
						})
				})
				.catch(error => {
				
				})
			},
			sent() {
				if (!this.info.expOrder) {
					this.$notify({
						title: '提示',
						message: '请填写物流单号',
						duration: 2000
					});
					return
				}
				this.axios.post("/admin/user/sentExp", {
					expOrder:this.info.expOrder,
					id:this.info.id,
				}).then(res => {
						this.$message.success({
							message: "发货成功",
							onClose: (res) => {
								this.reload()
							}
						})
				})
				.catch(error => {

				})
			}
		}
	}
</script>

<style>
</style>
